package com.it;

import com.it.bean.R;
import com.it.bean.RestStatusEnum;
import com.it.pojo.City;
import com.it.pojo.Province;
import com.it.pojo.vo.dict.AdminDictVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/dict")
@Api(value = "v1", tags = "字典相关接口")
public class DictController {


    @Resource
    private DictService dictService;

    @GetMapping("/province")
    public R<?> listProvine() {
        List<Province> provinceList = dictService.listProvine();
        return R.success("成功", provinceList);
    }

    @GetMapping("/city")
    public R<?> listCity() {

        List<City> cities = dictService.listCity();

        return R.success("成功", cities);
    }

    @GetMapping("/city/{provinceId}")
    public R<?> listCity(@PathVariable("provinceId") String provinceId) {
        List<City> cities = dictService.listCity(provinceId);
        return R.success("成功", cities);
    }

    @GetMapping("/area")
    public R<?> listArea() {
//        dictService.listArea();

//        return R.success("成功", cities);
        return null;

    }

    @GetMapping("/hotcity")
    public R<?> listHotCity() {
        List<City> cities = dictService.listHotCity();
        return R.success("成功", cities);
    }

    @ApiOperation(value = "查询所有数据字典", notes = "查询所有数据字典")
    @GetMapping("")
    public R<?> listDicts() {
        List<AdminDictVO> adminDictVOS = dictService.listDicts();
        return R.success("成功", adminDictVOS);
    }

    @GetMapping("params")
    @ApiOperation(value = "查询展会所需参数", notes = "查询展会所需参数")
    public R<?> listParams() {
        Map<String, Object> map = dictService.listParams();
        return R.success("场馆", map);
    }
}
